<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view>
			<text class="title">{{title}}</text>
			<MyButton/>
			<button @click="login">登录</button>
			<uni-badge text="1"></uni-badge>
			<uni-badge text="2" type="success" @click="bindClick"></uni-badge>
			<uni-badge text="3" type="primary" :inverted="true"></uni-badge>
		</view>
	</view>
</template>

<script>
	import http from '@/utils/http';
	// import MyButton from '@/components/MyButton/MyButton.vue'
	export default {
		// components: {
		// 	MyButton
		// },
		data() {
			return {
				title: 'Hello'
			}
		},
		async onLoad() {
			console.log(this.$store.state.user.token);
			// console.log(this.$store.state.user.userInfo.roles.menus);
			console.log(this.$store.getters.menus);
			const res = await uni.request({
				url: '/topics'
			})
			console.log(res);
			const resHttp = await http({
				url: '/topics'
			})
			console.log(resHttp);
		},
		methods: {
			login() {
				this.$store.commit('user/setToken', 6789)
				console.log('登录后的 token' );
				console.log(this.$store.state.user.token);

			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin: 200rpx auto 50rpx auto;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
